\(\int \frac {a+i a \tan (e+f x)}{c+d \tan (e+f x)} \, dx\) [1085]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 45 \[ \int \frac {a+i a \tan (e+f x)}{c+d \tan (e+f x)} \, dx=\frac {a x}{c-i d}+\frac {a \log (c \cos (e+f x)+d \sin (e+f x))}{(i c+d) f} \]

[Out]

a*x/(c-I*d)+a*ln(c*cos(f*x+e)+d*sin(f*x+e))/(I*c+d)/f

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.077, Rules used = {3612, 3611} \[ \int \frac {a+i a \tan (e+f x)}{c+d \tan (e+f x)} \, dx=\frac {a \log (c \cos (e+f x)+d \sin (e+f x))}{f (d+i c)}+\frac {a x}{c-i d} \]

[In]

Int[(a + I*a*Tan[e + f*x])/(c + d*Tan[e + f*x]),x]

[Out]

(a*x)/(c - I*d) + (a*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/((I*c + d)*f)

Rule 3611

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c/(b*f))
*Log[RemoveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {a x}{c-i d}+\frac {a \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{i c+d} \\ & = \frac {a x}{c-i d}+\frac {a \log (c \cos (e+f x)+d \sin (e+f x))}{(i c+d) f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.29 (sec) , antiderivative size = 39, normalized size of antiderivative = 0.87 \[ \int \frac {a+i a \tan (e+f x)}{c+d \tan (e+f x)} \, dx=\frac {a (-\log (i+\tan (e+f x))+\log (c+d \tan (e+f x)))}{(i c+d) f} \]

[In]

Integrate[(a + I*a*Tan[e + f*x])/(c + d*Tan[e + f*x]),x]

[Out]

(a*(-Log[I + Tan[e + f*x]] + Log[c + d*Tan[e + f*x]]))/((I*c + d)*f)

Maple [A] (verified)

Time = 0.26 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.44

method result size
norman \(\frac {a x}{-i d +c}+\frac {i a \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f \left (-i d +c \right )}-\frac {i a \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (-i d +c \right )}\) \(65\)
derivativedivides \(\frac {a \left (\frac {\frac {\left (i c -d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (i d +c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}-\frac {\left (i c -d \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{c^{2}+d^{2}}\right )}{f}\) \(83\)
default \(\frac {a \left (\frac {\frac {\left (i c -d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (i d +c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}-\frac {\left (i c -d \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{c^{2}+d^{2}}\right )}{f}\) \(83\)
risch \(-\frac {2 a x}{i d -c}-\frac {2 i a x}{i c +d}-\frac {2 i a e}{f \left (i c +d \right )}+\frac {a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right )}{f \left (i c +d \right )}\) \(87\)
parallelrisch \(\frac {2 i x a d f +i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a c -2 i \ln \left (c +d \tan \left (f x +e \right )\right ) a c +2 x a c f -\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a d +2 \ln \left (c +d \tan \left (f x +e \right )\right ) a d}{2 f \left (c^{2}+d^{2}\right )}\) \(91\)

[In]

int((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

a*x/(c-I*d)+1/2*I*a/f/(c-I*d)*ln(1+tan(f*x+e)^2)-I*a/f/(c-I*d)*ln(c+d*tan(f*x+e))

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 43, normalized size of antiderivative = 0.96 \[ \int \frac {a+i a \tan (e+f x)}{c+d \tan (e+f x)} \, dx=\frac {a \log \left (\frac {{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right )}{{\left (i \, c + d\right )} f} \]

[In]

integrate((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="fricas")

[Out]

a*log(((I*c + d)*e^(2*I*f*x + 2*I*e) + I*c - d)/(I*c + d))/((I*c + d)*f)

Sympy [A] (verification not implemented)

Time = 0.69 (sec) , antiderivative size = 44, normalized size of antiderivative = 0.98 \[ \int \frac {a+i a \tan (e+f x)}{c+d \tan (e+f x)} \, dx=- \frac {i a \log {\left (\frac {c + i d}{c e^{2 i e} - i d e^{2 i e}} + e^{2 i f x} \right )}}{f \left (c - i d\right )} \]

[In]

integrate((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x)

[Out]

-I*a*log((c + I*d)/(c*exp(2*I*e) - I*d*exp(2*I*e)) + exp(2*I*f*x))/(f*(c - I*d))

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 90 vs. \(2 (41) = 82\).

Time = 0.42 (sec) , antiderivative size = 90, normalized size of antiderivative = 2.00 \[ \int \frac {a+i a \tan (e+f x)}{c+d \tan (e+f x)} \, dx=\frac {\frac {2 \, {\left (a c + i \, a d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} + \frac {2 \, {\left (-i \, a c + a d\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{2} + d^{2}} + \frac {{\left (i \, a c - a d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}}}{2 \, f} \]

[In]

integrate((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="maxima")

[Out]

1/2*(2*(a*c + I*a*d)*(f*x + e)/(c^2 + d^2) + 2*(-I*a*c + a*d)*log(d*tan(f*x + e) + c)/(c^2 + d^2) + (I*a*c - a
*d)*log(tan(f*x + e)^2 + 1)/(c^2 + d^2))/f

Giac [A] (verification not implemented)

none

Time = 0.37 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.51 \[ \int \frac {a+i a \tan (e+f x)}{c+d \tan (e+f x)} \, dx=-\frac {\frac {i \, a \log \left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - c\right )}{c - i \, d} - \frac {2 i \, a \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}{c - i \, d}}{f} \]

[In]

integrate((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="giac")

[Out]

-(I*a*log(c*tan(1/2*f*x + 1/2*e)^2 - 2*d*tan(1/2*f*x + 1/2*e) - c)/(c - I*d) - 2*I*a*log(tan(1/2*f*x + 1/2*e)
+ I)/(c - I*d))/f

Mupad [B] (verification not implemented)

Time = 6.18 (sec) , antiderivative size = 43, normalized size of antiderivative = 0.96 \[ \int \frac {a+i a \tan (e+f x)}{c+d \tan (e+f x)} \, dx=-\frac {a\,\mathrm {atan}\left (\frac {c\,1{}\mathrm {i}-d+d\,\mathrm {tan}\left (e+f\,x\right )\,2{}\mathrm {i}}{c-d\,1{}\mathrm {i}}\right )\,2{}\mathrm {i}}{f\,\left (d+c\,1{}\mathrm {i}\right )} \]

[In]

int((a + a*tan(e + f*x)*1i)/(c + d*tan(e + f*x)),x)

[Out]

-(a*atan((c*1i - d + d*tan(e + f*x)*2i)/(c - d*1i))*2i)/(f*(c*1i + d))